<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<title>Music Store 后台订单管理</title>

<script>
$(function(){
	$(".state").click(function(){
		if (confirm("确认发货吗？")) {
			var id=$(this).attr("data");
			window.location="hom/statusUpdate?id="+id;
		}
	})
})
</script>


<div id="content-title">
	<h3>订单管理</h3>
</div>
<div id="content-main">
	<form action="hom/selectOrde" method="post">
		<table border="0" cellspacing="" cellpadding="">
			<tr>
				<td>发货状态: <select name="state">
						<option value="0">请选择</option>
						<option value="1">未发货</option>
						<option value="2">已发货</option>
				</select>
				</td>
				<td>订单编号: <input type="text" id="" name="id" value="" />
				</td>
				<td>开始日期: <input type="text" id="" name="startTime" value="" />
				</td>
				<td>结束日期: <input type="text" id="" name="endTime" value="" />
				</td>
				<td><input type="submit" id="" name="sum" value="查询" /></td>
			</tr>
		</table>
	</form>
	<hr />
	<p>订单列表</p>
	<table id="album-list">
		<tr>
			<th>订单编号</th>
			<th>订单日期</th>
			<th>用户</th>
			<th>状态</th>
			<th>操作</th>
			<th>详细</th>
		</tr>
		<c:forEach var="i" items="${orders}">
		<tr>
			<td>${i.id}</td>
			<td><fmt:formatDate pattern="yyyy-MM-dd" value="${i.orderDate}" /></td>
			<td>${i.user.name}</td>
			<td><c:choose>
					<c:when test="${i.deliveried ==1 }">
									未发货
								</c:when>
					<c:otherwise>
									已发货
								</c:otherwise>
				</c:choose></td>
			<td><c:choose>
					<c:when test="${i.deliveried ==1 }">
						<input type="button" class="state" data="${i.id}" value="发货" />
					</c:when>
				</c:choose></td>
			<td><a href="hom/orde_details?id=${i.id}">详情</a></td>
		</tr>
	</c:forEach>
	</table>
</div>

